#ifndef __CORE_SINGLETON_HXX__
#define __CORE_SINGLETON_HXX__

#include "singleton.h"

namespace raytracer {

template<typename Dependencie>
DependOn<Dependencie>::DependOn()
{
   Dependencie::instance();
}

template<typename Dependencie>
DependOn<Dependencie>::~DependOn()
{

}

template<typename Derived>
Derived& Singleton<Derived>::instance()
{
   if(!__singleton_bridge) {
      __singleton_bridge = boost::make_shared<Derived>();
      SingletonManager::instance().m_register_instance(__singleton_bridge);
   }
   return *__singleton_bridge;
}

template<typename Derived>
Singleton<Derived>::~Singleton()
{

}

template<typename Derived>
Singleton<Derived>::Singleton()
{

}

template<typename Derived>
void Singleton<Derived>::break_bridge()
{
   Singleton<Derived>::__singleton_bridge.reset();
}

template<typename Derived>
boost::shared_ptr<Derived> Singleton<Derived>::__singleton_bridge;

} //end of namespace

#endif //__CORE_SINGLETON_HXX__
